package com.qf.hospital.mapper;

import com.qf.hospital.entity.SysRole;
import com.qf.hospital.entity.SysRoleExample;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface SysRoleMapper {
    long countByExample(SysRoleExample example);

    int deleteByExample(SysRoleExample example);

    int deleteByPrimaryKey(Integer roleId);

    int insert(SysRole record);

    int insertSelective(SysRole record);

    List<SysRole> selectByExample(SysRoleExample example);

    SysRole selectByPrimaryKey(Integer roleId);

    int updateByExampleSelective(@Param("record") SysRole record, @Param("example") SysRoleExample example);

    int updateByExample(@Param("record") SysRole record, @Param("example") SysRoleExample example);

    int updateByPrimaryKeySelective(SysRole record);

    int updateByPrimaryKey(SysRole record);

    @Select("select mid from sys_role_menu where rid = #{roleId}")
    List<Integer> findMenuIdByRoleId(@Param("roleId") Integer roleid);

    /**
     * 删除角色的全部菜单
     * @param roleid
     */
    @Delete("delete from sys_role_menu where rid = #{roleId}")
    void deleteRoleMenus(@Param("roleId") Integer roleid);

    /**
     * 批量添加角色菜单
     * @param roleid
     * @param ids
     * @return
     */
    int saveRoleMenu(@Param("roleid") Integer roleid, @Param("ids") Integer[] ids);
}